import axios from 'axios';
const service = axios.create({
    baseURL: "", // api 的 base_url
    timeout: 100000, // 请求超时时间
    headers: {
  
    },
    responseType:'json',
    withCredentials: true,
    // transformRequest: [function (data) {
    //   // 对 data 进行任意转换处理
    //   return transformRequest(data)
    // }],
  })
  service.interceptors.request.use(
    config => {
  
  
      return config
    },
    error => {
  
      // Do something with request error
      console.log(error) // for debug
      Promise.reject(error)
    }
  )

  service.interceptors.response.use(

    response => {
  
  
      const res = response.data
      let code=res.code
      if(code=="200"){
        return res.data;
      }
   
      return Promise.reject(res)
  
  
  
    },
    error => {
  
  
   
      return Promise.reject(error)
    }
  )